<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Epigraph: include/problem.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Epigraph
   </div>
   <div id="projectbrief">Convex Optimization in C++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">problem.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="problem_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="constraint_8hpp.html">constraint.hpp</a>&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">namespace </span>cvx</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;{</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html">   15</a></span>&#160;    <span class="keyword">class </span><a class="code" href="classcvx_1_1OptimizationProblem.html">OptimizationProblem</a></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    {</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keyword">public</span>:</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#abfe91b330b443ac84cfd587063aa244f">   24</a></span>&#160;        <a class="code" href="classcvx_1_1Scalar.html">Scalar</a> <a class="code" href="classcvx_1_1OptimizationProblem.html#abfe91b330b443ac84cfd587063aa244f">addVariable</a>(<span class="keyword">const</span> std::string &amp;name);</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a4b8a6155c7e6d772df97b443c509dab0">   33</a></span>&#160;        VectorX <a class="code" href="classcvx_1_1OptimizationProblem.html#a4b8a6155c7e6d772df97b443c509dab0">addVariable</a>(<span class="keyword">const</span> std::string &amp;name,</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                            <span class="keywordtype">size_t</span> rows);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a2ea9bdaa633f988edf94fee34a57d2f1">   44</a></span>&#160;        MatrixX <a class="code" href="classcvx_1_1OptimizationProblem.html#a2ea9bdaa633f988edf94fee34a57d2f1">addVariable</a>(<span class="keyword">const</span> std::string &amp;name,</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                            <span class="keywordtype">size_t</span> rows,</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;                            <span class="keywordtype">size_t</span> cols);</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#af0320ee7149f1e0e28e8427fa6b316f7">   53</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#af0320ee7149f1e0e28e8427fa6b316f7">addConstraint</a>(<span class="keyword">const</span> <a class="code" href="classcvx_1_1Constraint.html">Constraint</a> &amp;constraint);</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a0fb876175eb892de311efd8704bdeb0e">   60</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a0fb876175eb892de311efd8704bdeb0e">addConstraint</a>(<span class="keyword">const</span> std::vector&lt;Constraint&gt; &amp;constraints);</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a75c10fd63c47fffe804f7d3aae574eb5">   67</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a75c10fd63c47fffe804f7d3aae574eb5">addCostTerm</a>(<span class="keyword">const</span> <a class="code" href="classcvx_1_1Scalar.html">Scalar</a> &amp;term);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a9818d4e171743cab08a1480ac4c7a2af">   75</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a9818d4e171743cab08a1480ac4c7a2af">getVariableValue</a>(<span class="keyword">const</span> std::string &amp;name, <span class="keywordtype">double</span> &amp;var);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160; </div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a1c7f53afd74d9724b2a2dbeda65bc613">   83</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a1c7f53afd74d9724b2a2dbeda65bc613">getVariableValue</a>(<span class="keyword">const</span> std::string &amp;name, Eigen::VectorXd &amp;var);</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a9ef5ac55c726ec9fd68693040d90df13">   91</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a9ef5ac55c726ec9fd68693040d90df13">getVariableValue</a>(<span class="keyword">const</span> std::string &amp;name, Eigen::MatrixXd &amp;var);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a5c2faa0df1d338baa80458e4b32008f2">   99</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a5c2faa0df1d338baa80458e4b32008f2">getVariable</a>(<span class="keyword">const</span> std::string &amp;name, <a class="code" href="classcvx_1_1Scalar.html">Scalar</a> &amp;var);</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#ab7b3c5e8597258031b9273c4ad33b1a6">  107</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#ab7b3c5e8597258031b9273c4ad33b1a6">getVariable</a>(<span class="keyword">const</span> std::string &amp;name, VectorX &amp;var);</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a106f964baf1e9c6e3377ad1eccbe3638">  115</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a106f964baf1e9c6e3377ad1eccbe3638">getVariable</a>(<span class="keyword">const</span> std::string &amp;name, MatrixX &amp;var);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160; </div>
<div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#aecc236200739347500afced6697304f9">  124</a></span>&#160;        <span class="keywordtype">double</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#aecc236200739347500afced6697304f9">getOptimalValue</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160; </div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="classcvx_1_1OptimizationProblem.html#a922fd3425387f68eabf93c39cdd15184">  131</a></span>&#160;        <span class="keywordtype">size_t</span> <a class="code" href="classcvx_1_1OptimizationProblem.html#a922fd3425387f68eabf93c39cdd15184">getNumVariables</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        <span class="keyword">friend</span> std::ostream &amp;operator&lt;&lt;(std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classcvx_1_1OptimizationProblem.html">OptimizationProblem</a> &amp;socp);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        <span class="keyword">friend</span> internal::SOCPWrapperBase;</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        <span class="keyword">friend</span> internal::QPWrapperBase;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keyword">private</span>:</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        <a class="code" href="classcvx_1_1Scalar.html">Scalar</a> costFunction;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        std::vector&lt;internal::EqualityConstraint&gt; equality_constraints;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        std::vector&lt;internal::PositiveConstraint&gt; positive_constraints;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        std::vector&lt;internal::BoxConstraint&gt; box_constraints;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        std::vector&lt;internal::SecondOrderConeConstraint&gt; second_order_cone_constraints;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160; </div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        std::map&lt;std::string, Scalar&gt; scalar_variables;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        std::map&lt;std::string, VectorX&gt; vector_variables;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        std::map&lt;std::string, MatrixX&gt; matrix_variables;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    };</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160; </div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;} <span class="comment">// namespace cvx</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a0fb876175eb892de311efd8704bdeb0e"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a0fb876175eb892de311efd8704bdeb0e">cvx::OptimizationProblem::addConstraint</a></div><div class="ttdeci">void addConstraint(const std::vector&lt; Constraint &gt; &amp;constraints)</div><div class="ttdoc">Add multiple constraints to the problem.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a5c2faa0df1d338baa80458e4b32008f2"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a5c2faa0df1d338baa80458e4b32008f2">cvx::OptimizationProblem::getVariable</a></div><div class="ttdeci">void getVariable(const std::string &amp;name, Scalar &amp;var)</div><div class="ttdoc">Get a scalar variable that exists in the problem.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a106f964baf1e9c6e3377ad1eccbe3638"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a106f964baf1e9c6e3377ad1eccbe3638">cvx::OptimizationProblem::getVariable</a></div><div class="ttdeci">void getVariable(const std::string &amp;name, MatrixX &amp;var)</div><div class="ttdoc">Get a matrix variable that exists in the problem.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a4b8a6155c7e6d772df97b443c509dab0"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a4b8a6155c7e6d772df97b443c509dab0">cvx::OptimizationProblem::addVariable</a></div><div class="ttdeci">VectorX addVariable(const std::string &amp;name, size_t rows)</div><div class="ttdoc">Creates and returns a vector of variables.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a9ef5ac55c726ec9fd68693040d90df13"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a9ef5ac55c726ec9fd68693040d90df13">cvx::OptimizationProblem::getVariableValue</a></div><div class="ttdeci">void getVariableValue(const std::string &amp;name, Eigen::MatrixXd &amp;var)</div><div class="ttdoc">Get the value of a matrix variable.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_aecc236200739347500afced6697304f9"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#aecc236200739347500afced6697304f9">cvx::OptimizationProblem::getOptimalValue</a></div><div class="ttdeci">double getOptimalValue() const</div><div class="ttdoc">Returns the evaluated cost function. Only call this after the problem has been solved.</div></div>
<div class="ttc" id="aclasscvx_1_1Constraint_html"><div class="ttname"><a href="classcvx_1_1Constraint.html">cvx::Constraint</a></div><div class="ttdef"><b>Definition:</b> constraint.hpp:47</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a1c7f53afd74d9724b2a2dbeda65bc613"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a1c7f53afd74d9724b2a2dbeda65bc613">cvx::OptimizationProblem::getVariableValue</a></div><div class="ttdeci">void getVariableValue(const std::string &amp;name, Eigen::VectorXd &amp;var)</div><div class="ttdoc">Get the value of a vector variable.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html">cvx::OptimizationProblem</a></div><div class="ttdef"><b>Definition:</b> problem.hpp:16</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a922fd3425387f68eabf93c39cdd15184"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a922fd3425387f68eabf93c39cdd15184">cvx::OptimizationProblem::getNumVariables</a></div><div class="ttdeci">size_t getNumVariables() const</div><div class="ttdoc">Returns the number of used variables in the problem.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a75c10fd63c47fffe804f7d3aae574eb5"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a75c10fd63c47fffe804f7d3aae574eb5">cvx::OptimizationProblem::addCostTerm</a></div><div class="ttdeci">void addCostTerm(const Scalar &amp;term)</div><div class="ttdoc">Add a cost term to the problem's cost function. This has to be a scalar.</div></div>
<div class="ttc" id="aconstraint_8hpp_html"><div class="ttname"><a href="constraint_8hpp.html">constraint.hpp</a></div></div>
<div class="ttc" id="aclasscvx_1_1Scalar_html"><div class="ttname"><a href="classcvx_1_1Scalar.html">cvx::Scalar</a></div><div class="ttdef"><b>Definition:</b> expressions.hpp:117</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a2ea9bdaa633f988edf94fee34a57d2f1"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a2ea9bdaa633f988edf94fee34a57d2f1">cvx::OptimizationProblem::addVariable</a></div><div class="ttdeci">MatrixX addVariable(const std::string &amp;name, size_t rows, size_t cols)</div><div class="ttdoc">Creates and returns a matrix of variables.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_a9818d4e171743cab08a1480ac4c7a2af"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#a9818d4e171743cab08a1480ac4c7a2af">cvx::OptimizationProblem::getVariableValue</a></div><div class="ttdeci">void getVariableValue(const std::string &amp;name, double &amp;var)</div><div class="ttdoc">Get the value of a scalar variable.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_af0320ee7149f1e0e28e8427fa6b316f7"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#af0320ee7149f1e0e28e8427fa6b316f7">cvx::OptimizationProblem::addConstraint</a></div><div class="ttdeci">void addConstraint(const Constraint &amp;constraint)</div><div class="ttdoc">Add a single constraint to the problem. found.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_abfe91b330b443ac84cfd587063aa244f"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#abfe91b330b443ac84cfd587063aa244f">cvx::OptimizationProblem::addVariable</a></div><div class="ttdeci">Scalar addVariable(const std::string &amp;name)</div><div class="ttdoc">Creates and returns a variable.</div></div>
<div class="ttc" id="aclasscvx_1_1OptimizationProblem_html_ab7b3c5e8597258031b9273c4ad33b1a6"><div class="ttname"><a href="classcvx_1_1OptimizationProblem.html#ab7b3c5e8597258031b9273c4ad33b1a6">cvx::OptimizationProblem::getVariable</a></div><div class="ttdeci">void getVariable(const std::string &amp;name, VectorX &amp;var)</div><div class="ttdoc">Get a vector variable that exists in the problem.</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
